package cn.wsalix.admin.form;

import java.util.Date;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import lombok.Data;
import lombok.EqualsAndHashCode;
import cn.anlaser.form.CommonForm;
import cn.wsalix.admin.entity.SysRole;
import cn.wsalix.admin.entity.SysUser;
import cn.wsalix.admin.status.UserEnum;
import cn.wsalix.admin.type.CodeOperaEnum;
import cn.wsalix.type.UserRegTypeEnum;

@Data
@EqualsAndHashCode(callSuper = false)
public class UserForm extends CommonForm {
	@NotNull
	@Size(min = 4, max = 12)
	private String username;
	@NotNull
	@Size(min = 4, max = 12)
	private String realname;
	@NotNull
	@Size(min = 4, max = 12)
	private String oldPassword;
	@NotNull
	@Size(min = 4, max = 12)
	private String password;
	@NotNull
	private CodeOperaEnum operateType;
	@NotNull
	private String platform;
	@NotNull
	private String loginWay; // 登陆方式 1，手机密码登陆 2，第三方账号登陆
	@NotNull
	private UserRegTypeEnum thirdType; // 第三方账号登陆类型
	// @NotNull
	// private UserRegTypeEnum regType; // 第三方账号登陆类型
	//@NotNull
	//private UserTypeEnum userType; // 前台、后台类型

	private String accessToken;
	private String expires_in;

	private String openid;// 第三方账号ID(1,微信 unionID,2,QQ openId 3,新浪 uid)
	@NotNull
	@Size(min = 4, max = 12)
	private String nickname;
	private String gender;
	private String country;
	private String province;
	private String city;
	private String avatar;
	private String unionid;

	private String custNickName; //
	private String custHeadPic; //
	private String custSex; //
	private String custPhone; //
	private String custPassword; //
	private String salt;
	// private String userType;
	private Long roleId;
	private Long unRoleId;
	@NotNull
	private String verifyCode;// 验证码
	// @Digits(fraction = 0, integer = 12)

	//
	private String phone;
	private String email;

	private String remark;// 描述
	private Date birthday;
	private String sex;
	private UserEnum status;

	public void setThirdType(UserRegTypeEnum thirdType) {
		this.thirdType = thirdType;
	}

	public void setSex(String sex) {
		this.sex = sex;
		this.gender = sex;
	}

	// temporary variable
	private SysUser user;
	private boolean create = true;// 是否创建用户,验证码不通过则改为false
	private Long shopId;
	private SysRole mainRole;
}
